
 
 F u n c t i o n :   e m p t y ( d o m E l e m e n t ,   b o o l A l s o R e m o v e P a r e n t ) 
 
 
 
 D e s c r i p t i o n :   R e m o v e s   a l l   D O M   n o d e s   a n d   a s s o c i a t e d   d a t a   c o n t a i n e d   w i t h i n   a n   e l e m e n t . 
 
 
 
 R e t u r n s :   d o m E l e m e n t ,   n u l l ,   o r   $ A   o b j e c t   i f   c h a i n e d . 
 
 
 
 N o t e :   A l l   a t t a c h e d   e v e n t   h a n d l e r s   a n d   d a t a   b i n d i n g s   a r e   a l s o   r e m o v e d   t o   p r e v e n t   m e m o r y   l e a k s .   W h e n   b o o l A l s o R e m o v e P a r e n t   i s   f a l s e   o r   u n d e f i n e d ,   t h e   r e f e r e n c e d   e l e m e n t   i s   r e t u r n e d   w h e n   p r o c e s s i n g   i s   c o m p l e t e .   w h e n   b o o l A l s o R e m o v e P a r e n t   i s   t r u e   h o w e v e r ,   t h e   r e f e r e n c e d   e l e m e n t   i s   a l s o   r e m o v e d ,   a n d   a   n u l l   r e f e r e n c e   i s   r e t u r n e d   i n s t e a d .   U s e   o f   t h e   b o o l A l s o R e m o v e P a r e n t   p a r a m e t e r   p e r f o r m s   t h e   s a m e   a c t i o n   a s   t h e   r e m o v e ( )   f u n c t i o n . 
 
 
 
 E x a m p l e : 
 
 
 
 / /   E m p t y   a   D O M   e l e m e n t   a n d   r e m o v e   a l l   a s s o c i a t e d   e v e n t   b i n d i n g s   a n d   d a t a 
 
 v a r   m y E l e m e n t   =   $ A . e m p t y ( d o m E l e m e n t ) ; 
 
 
 
 / /   R e m o v e   a   D O M   e l e m e n t   a n d   r e m o v e   a l l   a s s o c i a t e d   e v e n t   b i n d i n g s   a n d   d a t a 
 
 $ A . e m p t y ( d o m E l e m e n t ,   t r u e ) ; 
 
 
 
 / /   O r   t h e   s a m e   u s i n g   c h a i n i n g 
 
 
 
 / /   E m p t y   a   D O M   e l e m e n t   a n d   r e m o v e   a l l   a s s o c i a t e d   e v e n t   b i n d i n g s   a n d   d a t a 
 
 v a r   m y C h a i n   =   $ A ( d o m E l e m e n t ) . e m p t y ( ) ; 
 
 
 
 / /   R e m o v e   a   D O M   e l e m e n t   a n d   r e m o v e   a l l   a s s o c i a t e d   e v e n t   b i n d i n g s   a n d   d a t a 
 
 $ A ( d o m E l e m e n t ) . e m p t y ( t r u e ) ; 
 
 
 
 / /   T o   r e t u r n   t h e   m o d i f i e d   e l e m e n t   w i t h i n   a   c h a i n ,   u s e   t h e   " r e t u r n ( ) "   m e t h o d . 
 
 
 
 v a r   m y E l e m e n t   =   m y C h a i n . r e t u r n ( ) ; 
 
 